<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //案例1：遍历数组
        //1.声明函数
        function findAll(){
            var arr = ['胡歌','彭于晏','杨洋'];
            for  (var i =0 ; i<3; i++){
                console.log(arr[i]);
            }
            console.log(('-------end------'));

        }
        //2.调用函数
        findAll();
        findAll();
        //利用函数计算1-100值键的累加和
        function getSum(){
            var sum = 0;
            for (var i = 1; i<=100; i++){
                sum +=i;
            }
            console.log(sum);
        }
        getSum();
        getSum();
    </script>
</head>
<body>
    
</body>
</html>